﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using LIMS.Entities;
using LIMS.Shared;


namespace LIMS.Windows
{
    public partial class DepartmentPopUp : Form
    {
        public User oUser = new User();
        private string sDepartmentID = string.Empty;
        private int iUserType = 0;
        public string DepartmentID
        {
            get { return sDepartmentID; }
            set { sDepartmentID = value; }
        }
        public DepartmentPopUp(User p_oUser, int p_UserType)
        {
            InitializeComponent();
            oUser = p_oUser;
            iUserType = p_UserType;
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            DepartmentID = Convert.ToString(cmbDept.SelectedValue);
           
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void DepartmentPopUp_Load(object sender, EventArgs e)
        {
            //List<Department> oDepartment = SharedResource.GetHODDept(oUser, true);

            //if (iUserType == 1)
            //{
            //    chkListDept.Visible = true;
            //    cmbDept.Visible = false;
            //    foreach (var item in oDepartment)
            //    {
            //        if (item.Id>0)
            //            chkListDept.Items.Add(item.Name);
            //    }
            //}
            //else if (iUserType == 2)
            //{
                chkListDept.Visible = false;
                cmbDept.Visible = true;
                cmbDept.DataSource = SharedResource.GetHODDept(oUser, true);
                cmbDept.DisplayMember = "Name";
                cmbDept.ValueMember = "Id";
            //}
        }
    }
}
